<!DOCTYPE html [
    <!ENTITY nbsp "&#160;">
    <!ENTITY bull "&#8226;">
    <!ENTITY copy "&#169;">
]>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
	<title>保护修正</title>
</h:head>
		<link rel="stylesheet"
			href="/resources/plugins/datatables/dataTables.bootstrap.css" />
<!-- 设备维护 -->
<h:form id="updateButtonForm">
	<p:growl id="msg" showDetail="true" />
	<p:commandButton id="编辑" value="编辑" icon="ui-icon-disk"
		update="msg updateDlgForm:editDlg" actionListener="#{protectCheckDialogController.checkSelected}" 
		oncomplete="PF('editDlg').show()"/>
</h:form>
<h:form id="incorrectProForm">
 <ui:repeat value="#{protectCheckDialogController.currentDeviceProList}" var="sp">
	<p:growl id="proRevisesMsgs" showDetail="true" />
		<p:outputPanel  style="float:left;width:49%;margin-left:8px">
			<p:dataTable id="incorrectTable" style="text-align:center;"  editable="true" editMode="cell" 
			var="incorrectPro" rowKey="#{incorrectPro.id}"  value="#{sp.proList}" 
			selection="#{protectCheckDialogController.selected}" 
			selectionMode="single" emptyMessage="无记录"  sortBy="#{incorrectPro.protectedType}">
				<f:facet name="header">
					#{sp.stationName}
			    </f:facet>
			    <p:ajax event="rowSelect"/>
				<p:ajax event="cellEdit" listener="#{protectCheckDialogController.onCellEdit}" />
				<p:column width="200" headerText="保护名称">
					<h:outputText value="#{incorrectPro.name}" />
				</p:column>
				<p:column width="80" headerText="被保护设备">
					<h:outputText value="#{incorrectPro.protectedName}" />
				</p:column>
				<p:column width="80" headerText="被保护类型">
					<h:outputText value="#{incorrectPro.protectedType}" />
				</p:column>
				<p:column width="90" headerText="类型">
					<p:cellEditor>
						<f:facet name="output">
							<p:outputLabel value="#{incorrectPro.type}" />
						</f:facet>
						<f:facet name="input">
							<p:selectOneMenu id="lazy" value="#{incorrectPro.type}" style="width:125px">
					            <f:selectItem itemLabel=" " itemValue="" />
					            <f:selectItems value="#{protectCheckDialogController.proKinds}" />
					        </p:selectOneMenu>
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column width="120" headerText="保护型号">
					<p:cellEditor>
						<f:facet name="output">
							<p:outputLabel value="#{incorrectPro.devType}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{incorrectPro.devType}"/>
						</f:facet>
					</p:cellEditor>
				</p:column>
			</p:dataTable>
		</p:outputPanel>
	</ui:repeat>
</h:form>
<!-- 编辑dialog -->
<h:form id="updateDlgForm">
<p:growl id="proRevisesMsgs1" showDetail="true" />
	<p:dialog id="editDlg" widgetVar="editDlg" header="保护编辑" modal="true" width="420" height="350">
		<p:toolbar>
			<f:facet name="left">
				<p:commandButton id="editSaveBtn" value="保存" icon="ui-icon-disk"
					update="updateButtonForm:msg incorrectProForm" oncomplete="PF('editDlg').hide()"
					actionListener="#{protectCheckDialogController.update}" />
			</f:facet>
		</p:toolbar>
		<p:outputPanel id="editDetail" style="text-align:center;">
			<p:panelGrid columns="2">
				<h:outputText value="保护名称" />
				<p:inputText value="#{protectCheckDialogController.selected.name}" style="width:100%"
					label="protectedName"></p:inputText>
				<h:outputText value="保护类型" />
				<p:selectOneMenu
					value="#{protectCheckDialogController.selected.type}"
					style="width:90%">
					<f:selectItems value="#{protectCheckDialogController.proKinds}"
						var="type" itemLabel="#{type}" itemValue="#{type}" />
				</p:selectOneMenu>
				<h:outputText value="一次设备名称" />
				<p:row>
					<p:inputText readonly="true" id="priDeviceName" value="#{protectCheckDialogController.selected.protectedName}"/>
					<p:commandButton value="选择" actionListener="#{protectCheckDialogController.getEquipmentByStation}">
						<p:ajax event="dialogReturn" update="priDeviceName proRevisesMsgs1" listener="#{protectCheckDialogController.onEquDialogChosenListener}" />
					</p:commandButton>
				</p:row>
				<h:outputText value="一次设备类型" />
				<p:selectOneMenu
					value="#{protectCheckDialogController.selected.protectedType}"
					style="width:90%">
					<f:selectItems
						value="#{protectCheckDialogController.protectedTypes}"
						var="protectedType" itemLabel="#{protectedType}"
						itemValue="#{protectedType}" />
				</p:selectOneMenu>
				<h:outputText value="保护型号:" />
				<p:inputText value="#{protectCheckDialogController.selected.devType}"
					style="width:100%" label="devType"></p:inputText>
			</p:panelGrid>
		</p:outputPanel>
	</p:dialog>
</h:form>
</html>